package cn.source.web.controller.tool;
import cn.source.common.core.domain.AjaxResult;
import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiSnsGetuserinfoBycodeRequest;
import com.dingtalk.api.response.OapiSnsGetuserinfoBycodeResponse;
import com.taobao.api.ApiException;
public class DingDingUtil {
    public AjaxResult getUserInfoBySns(){
        try {
            DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/sns/getuserinfo_bycode");
            OapiSnsGetuserinfoBycodeRequest req = new OapiSnsGetuserinfoBycodeRequest();
            req.setTmpAuthCode("1");
            OapiSnsGetuserinfoBycodeResponse rsp = client.execute(req, "1" ,"1" ,"1");
            return AjaxResult.success(rsp.getBody());
        } catch (ApiException e) {
            e.printStackTrace();
            return null;
        }
    }
}
